/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.ufrpe.bsi.pvs.view.assistant;

import java.awt.Color;
import java.util.List;

import javax.swing.JLabel;

import org.jdom2.Document;

import br.ufrpe.bsi.pvs.Fachada;
import br.ufrpe.bsi.pvs.model.roupa.Estilo;
import br.ufrpe.bsi.pvs.model.roupa.Roupa;
import br.ufrpe.bsi.pvs.view.PvsFrame;
import br.ufrpe.bsi.pvs.xml.transformer.QueryXML;


public class TelaEstilo extends javax.swing.JPanel {

	public static TelaEstilo INSTANCE = new TelaEstilo();

	/**
	 * Creates new form TelaEstilo
	 */
	private TelaEstilo() {
		initComponents();
	}

	public void mouseEnterBorder(JLabel icon, String message) {
		icon.setBackground(new Color(245, 245, 245));
		lbStatus.setText(message);
	}

	public void mouseExitBorder(JLabel icon) {
		icon.setBackground(Color.WHITE);
		lbStatus.setText("");
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jPanel1 = new javax.swing.JPanel();
		Dia = new javax.swing.JLabel();
		Fashion = new javax.swing.JLabel();
		Casual = new javax.swing.JLabel();
		lbStatus = new javax.swing.JLabel();

		setBackground(java.awt.Color.white);

		jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/images/back.png"))); // NOI18N
		jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				jLabel1MouseClicked(evt);
			}
		});

		jLabel3.setBackground(java.awt.Color.black);
		jLabel3.setFont(new java.awt.Font("Gabriola", 0, 36)); // NOI18N
		jLabel3.setForeground(java.awt.Color.white);
		jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		jLabel3.setText("Selecione seu Estilo");
		jLabel3.setToolTipText("");
		jLabel3.setOpaque(true);

		jPanel1.setOpaque(false);
		jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER,
				80, 30));

		Dia.setBackground(java.awt.Color.white);
		Dia.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		Dia.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/images/estilo.png"))); // NOI18N
		Dia.setMaximumSize(new java.awt.Dimension(180, 400));
		Dia.setOpaque(true);
		Dia.setPreferredSize(new java.awt.Dimension(200, 400));
		Dia.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				DiaMouseClicked(evt);
			}

			public void mouseEntered(java.awt.event.MouseEvent evt) {
				DiaMouseEntered(evt);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				DiaMouseExited(evt);
			}
		});
		jPanel1.add(Dia);

		Fashion.setBackground(java.awt.Color.white);
		Fashion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		Fashion.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/images/fashion.png"))); // NOI18N
		Fashion.setMaximumSize(new java.awt.Dimension(180, 400));
		Fashion.setOpaque(true);
		Fashion.setPreferredSize(new java.awt.Dimension(200, 400));
		Fashion.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				FashionMouseClicked(evt);
			}

			public void mouseEntered(java.awt.event.MouseEvent evt) {
				FashionMouseEntered(evt);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				FashionMouseExited(evt);
			}
		});
		jPanel1.add(Fashion);

		Casual.setBackground(java.awt.Color.white);
		Casual.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
		Casual.setIcon(new javax.swing.ImageIcon(getClass().getResource(
				"/images/dia.png"))); // NOI18N
		Casual.setMaximumSize(new java.awt.Dimension(180, 400));
		Casual.setOpaque(true);
		Casual.setPreferredSize(new java.awt.Dimension(200, 400));
		Casual.addMouseListener(new java.awt.event.MouseAdapter() {
			public void mouseClicked(java.awt.event.MouseEvent evt) {
				CasualMouseClicked(evt);
			}

			public void mouseEntered(java.awt.event.MouseEvent evt) {
				CasualMouseEntered(evt);
			}

			public void mouseExited(java.awt.event.MouseEvent evt) {
				CasualMouseExited(evt);
			}
		});
		jPanel1.add(Casual);

		lbStatus.setFont(new java.awt.Font("Gabriola", 0, 24)); // NOI18N
		lbStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addComponent(
														lbStatus,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addGroup(
														javax.swing.GroupLayout.Alignment.TRAILING,
														layout.createSequentialGroup()
																.addComponent(
																		jLabel1,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		48,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addGap(18, 18,
																		18)
																.addComponent(
																		jLabel3,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		1110,
																		Short.MAX_VALUE))
												.addComponent(
														jPanel1,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addContainerGap()));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING,
												false)
												.addComponent(
														jLabel1,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE)
												.addComponent(
														jLabel3,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														javax.swing.GroupLayout.DEFAULT_SIZE,
														Short.MAX_VALUE))
								.addGap(18, 18, 18)
								.addComponent(jPanel1,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addPreferredGap(
										javax.swing.LayoutStyle.ComponentPlacement.RELATED,
										javax.swing.GroupLayout.DEFAULT_SIZE,
										Short.MAX_VALUE)
								.addComponent(lbStatus,
										javax.swing.GroupLayout.PREFERRED_SIZE,
										38,
										javax.swing.GroupLayout.PREFERRED_SIZE)
								.addContainerGap()));
	}// </editor-fold>//GEN-END:initComponents

	private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_jLabel1MouseClicked
		PvsFrame.INSTANCE.home();
	}// GEN-LAST:event_jLabel1MouseClicked

	private void DiaMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_DiaMouseClicked
		Query.getInstance().setEstilo(Estilo.CLASSICO);
		Document doc = QueryXML.parseQueryRequest(Query.getInstance());
		List<Roupa> result = (List<Roupa>) Fachada.sendRequest(doc);		
		PvsFrame.INSTANCE.result(result);
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_DiaMouseClicked

	private void DiaMouseEntered(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_DiaMouseEntered
		mouseEnterBorder((JLabel) evt.getSource(), "Dia a dia");
	}// GEN-LAST:event_DiaMouseEntered

	private void DiaMouseExited(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_DiaMouseExited
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_DiaMouseExited

	private void FashionMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_FashionMouseClicked
		Query.getInstance().setEstilo(Estilo.FASHION);
		Document doc = QueryXML.parseQueryRequest(Query.getInstance());
		List<Roupa> result = (List<Roupa>) Fachada.sendRequest(doc);		
		PvsFrame.INSTANCE.result(result);
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_FashionMouseClicked

	private void FashionMouseEntered(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_FashionMouseEntered
		mouseEnterBorder((JLabel) evt.getSource(), "Fashion");
	}// GEN-LAST:event_FashionMouseEntered

	private void FashionMouseExited(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_FashionMouseExited
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_FashionMouseExited

	private void CasualMouseClicked(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_CasualMouseClicked
		Query.getInstance().setEstilo(Estilo.CASUAL);
		Document doc = QueryXML.parseQueryRequest(Query.getInstance());
		List<Roupa> result = (List<Roupa>) Fachada.sendRequest(doc);
		PvsFrame.INSTANCE.result(result);
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_CasualMouseClicked

	private void CasualMouseEntered(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_CasualMouseEntered
		mouseEnterBorder((JLabel) evt.getSource(), "Casual");
	}// GEN-LAST:event_CasualMouseEntered

	private void CasualMouseExited(java.awt.event.MouseEvent evt) {// GEN-FIRST:event_CasualMouseExited
		mouseExitBorder((JLabel) evt.getSource());
	}// GEN-LAST:event_CasualMouseExited

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JLabel Casual;
	private javax.swing.JLabel Dia;
	private javax.swing.JLabel Fashion;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JLabel lbStatus;
	// End of variables declaration//GEN-END:variables
}
